package org.yate.oa.service.imp;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.yate.oa.dao.IBaseMapperDao;
import org.yate.oa.dao.mapper.RestDayMapper;
import org.yate.oa.model.RestDayEntity;
import org.yate.oa.service.IRestDayService;
import org.yate.oa.utils.Pagination;

@Service
public class RestDayService extends BaseService<RestDayEntity, Integer> implements IRestDayService {
	@Resource(name = "restDayMapper")
	private RestDayMapper restDayDao;

	@Override
	protected IBaseMapperDao<RestDayEntity, Integer> getMapperDao() {
		return this.restDayDao;
	}

	@Override
	public RestDayEntity getEntity(Integer userId) {
		return restDayDao.getEntity(userId);
	}

	@Override
	public boolean checkUserExist(Integer userId) {
		return this.restDayDao.getCountByUserId(userId) > 0;
	}

	@Override
	public Pagination<RestDayEntity> getEntitieSearch(int page, int rows, String orderField, String orderMode, String... strings) {
		Pagination<RestDayEntity> result = new Pagination<RestDayEntity>(page, rows);
		result.setRows(this.restDayDao.getEntitieSearch(result, orderField, orderMode, strings));
		return result;
	}

	@Override
	public List<RestDayEntity> getEntities() {
		return restDayDao.getEntities();
	}

	@Override
	public List<RestDayEntity> getCurrentQuaRestdays(final String... strings) {
		return restDayDao.getCurrentQuaRestdays(strings);
	}

	@Override
	public List<RestDayEntity> getEntitiesByUserIds(List<Integer> ids) {
		return restDayDao.getEntitiesByUserIds(ids);
	}
}
